using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_BillDETAILsumsMap : EntityTypeConfiguration<SO_BillDETAILsums>
    {
        public SO_BillDETAILsumsMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ITEM, t.DESCRIPTION, t.QTYSHIP, t.Item_TYPE, t.Currency, t.PRICE, t.cost, t.Tansaction_id, t.PATIENT_AMOUNT, t.GUARANTOR_1_AMOUNT, t.GUARANTOR_2_AMOUNT, t.discount_prec, t.Discount_amount, t.Gr_1_perc, t.gr_2_perc, t.SUMFIELDS, t.DIMFIELDS });

            // Properties
            this.Property(t => t.Bill_)
                .HasMaxLength(8);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.DESCRIPTION)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.LOCATION)
                .HasMaxLength(3);

            this.Property(t => t.Item_TYPE)
                .IsRequired()
                .HasMaxLength(25);

            this.Property(t => t.Currency)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Tansaction_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Master_item)
                .HasMaxLength(10);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(103);

            this.Property(t => t.DIMFIELDS)
                .IsRequired()
                .HasMaxLength(42);

            // Table & Column Mappings
            this.ToTable("SO_BillDETAILsums");
            this.Property(t => t.Bill_).HasColumnName("Bill#");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.DESCRIPTION).HasColumnName("DESCRIPTION");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.QTYSHIP).HasColumnName("QTYSHIP");
            this.Property(t => t.ENTRY_DATE).HasColumnName("ENTRY_DATE");
            this.Property(t => t.Item_TYPE).HasColumnName("Item_TYPE");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.EXTENDED_AMOUNT_base1).HasColumnName("EXTENDED_AMOUNT_base1");
            this.Property(t => t.EXTENDED_AMOUNT_base2).HasColumnName("EXTENDED_AMOUNT_base2");
            this.Property(t => t.PRICE).HasColumnName("PRICE");
            this.Property(t => t.cost).HasColumnName("cost");
            this.Property(t => t.Ext_CostT_base2).HasColumnName("Ext_CostT_base2");
            this.Property(t => t.Tansaction_id).HasColumnName("Tansaction_id");
            this.Property(t => t.PATIENT_AMOUNT).HasColumnName("PATIENT_AMOUNT");
            this.Property(t => t.GUARANTOR_1_AMOUNT).HasColumnName("GUARANTOR_1_AMOUNT");
            this.Property(t => t.GUARANTOR_2_AMOUNT).HasColumnName("GUARANTOR_2_AMOUNT");
            this.Property(t => t.discount_prec).HasColumnName("discount_prec");
            this.Property(t => t.Discount_amount).HasColumnName("Discount_amount");
            this.Property(t => t.Opeartion_serial).HasColumnName("Opeartion_serial");
            this.Property(t => t.Expiry).HasColumnName("Expiry");
            this.Property(t => t.Gr_1_perc).HasColumnName("Gr_1_perc");
            this.Property(t => t.gr_2_perc).HasColumnName("gr_2_perc");
            this.Property(t => t.Master_item).HasColumnName("Master_item");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DIMFIELDS).HasColumnName("DIMFIELDS");
        }
    }
}
